import React from 'react';
import type { ValueTextType } from '@/constants';
import { Radio } from 'antd';

const RadioGroup = Radio.Group;
const RadioButton = Radio.Button;

export const renderRadioGroup =
  (data: ValueTextType[], disabled: boolean = false) =>
  () => {
    return (
      <RadioGroup buttonStyle="solid">
        {data.map((item) => (
          <RadioButton key={item.value} value={item.value} disabled={disabled}>
            {item.text}
          </RadioButton>
        ))}
      </RadioGroup>
    );
  };
